{% extends "team/dashboard_base.html" %}

{% block subcontainer %}

	<div class="pulls bubble">
    <div class="header">
      <h2 class="heading">我创建的</h2>
      <span class="sortable btn-group">
        <a id="pullMerge" href="/{{teamUser.username}}/-/dashboard/pull/merge/" class="btn btn-mini first">需要我处理的</a>
        <a id="pullRequest"href="/{{teamUser.username}}/-/dashboard/pull/request/" class="btn btn-mini btn-disable last">我创建的</a>
      </span>
    </div>

			{% if pullRequests %}
				{% for pullRequest in pullRequests %}
            <section class="pull-item">

              <div class="pull">

                <figure class="avatar">
                  <img src="https://gravatar.com/avatar/{{pullRequest.desc_repo.username}}?s=38" alt="{{pullRequest.pull_user.username}}">
                </figure>

                <div class="info">

                  <h3 class="heading">
                    <a href="/{{pullRequest.desc_repo.username}}/{{pullRequest.desc_repo.name}}/pull/{{pullRequest.id}}/">{##{{pullRequest.id}}#}{{pullRequest.short_title}}</a>
                    <span class="label label-mini {{pullRequest.status_label}}">{{pullRequest.status_view}}</span>
                  </h3>

                  <div class="branches hide">

                    <span class="puller">
                      我想把
                    </span>

                    <span class="sub"><a href="/{{pullRequest.source_repo.username}}/{{pullRequest.source_repo.name}}/">{{pullRequest.source_repo.name}}</a>:<span{# href="/{{pullRequest.source_repo.username}}/{{pullRequest.source_repo.name}}/tree/{{pullRequest.source_refname}}/"#}>{{pullRequest.source_refname}}</span>
                    </span>合并到
                    <span class="master"><a href="/{{pullRequest.desc_repo.username}}/{{pullRequest.desc_repo.name}}/">{{pullRequest.desc_repo.name}}</a>:<span{# href="/{{pullRequest.desc_repo.username}}/{{pullRequest.desc_repo.name}}/tree/{{pullRequest.desc_refname}}/"#}>{{pullRequest.desc_refname}}</span>
                    </span>

                  </div>

                  <p class="desc">{{pullRequest.short_desc}}</p>

                </div>

            </div>
            </section>
				{% endfor %}
			{% else %}
        <div class="inner">
          <p class="alert blank-alert"><i class="icon-bell"></i><em>没有合并请求</em></p>
				</div>
			{% endif %}
	</div>


{% endblock %}

{% block js %}
  <script>
    $(function(){
        moment.lang('zh-cn');
        $('#pullMerge').click(function(){
            window.location.href = '/dashboard/pull/';
        });
        $('#pullRequest').click(function(){
            window.location.href = '/dashboard/pull/request/';
        });
    });
  </script>
{% endblock %}
